#include <material/editorshader.h>
#include <session.h>

EditorShader::EditorShader(ceShaderType type)
{
  CE_OBJECT_CONSTR
  _shader = Session::Get()->GetDevice()->CreateShader(type);

  if (_shader)
    {
      _shader->AddRef();
    }
}

EditorShader::~EditorShader()
{
  CE_UNSET (_shader);
}

iShader* EditorShader::GetSource()
{
  return _shader;
}

void EditorShader::ChangeType(ceShaderType type)
{
  _shader->ChangeType(type);
}

ceShaderType EditorShader::GetType() const
{
  return _shader->GetType();
}

void EditorShader::SetSource(const std::string &source)
{
  _shader->SetSource(source);
}

bool EditorShader::Compile()
{
  return _shader->Compile();
}

bool EditorShader::IsCompiled() const
{
  return _shader->IsCompiled();
}

std::string EditorShader::GetCompileInfoLog() const
{
  return _shader->GetCompileInfoLog();
}
